home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / List_Class2097321142008.psc / List Class / frmMain.frm < prev    next >
Text File  |  2008-01-14  |  4KB  |  139 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "List Class"
  5.    ClientHeight    =   3015
  6.    ClientLeft      =   45
  7.    ClientTop       =   345
  8.    ClientWidth     =   4215
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3015
  13.    ScaleWidth      =   4215
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.Frame fraEdit 
  16.       Caption         =   "Edit"
  17.       Height          =   2775
  18.       Left            =   2640
  19.       TabIndex        =   1
  20.       Top             =   120
  21.       Width           =   1455
  22.       Begin VB.CommandButton cmdAddItem 
  23.          Caption         =   "Add Item"
  24.          Height          =   375
  25.          Left            =   120
  26.          TabIndex        =   5
  27.          Top             =   240
  28.          Width           =   1215
  29.       End
  30.       Begin VB.CommandButton cmdRemoveItem 
  31.          Caption         =   "Remove Item"
  32.          Height          =   375
  33.          Left            =   120
  34.          TabIndex        =   4
  35.          Top             =   720
  36.          Width           =   1215
  37.       End
  38.       Begin VB.CommandButton cmdClear 
  39.          Caption         =   "Clear"
  40.          Height          =   375
  41.          Left            =   120
  42.          TabIndex        =   3
  43.          Top             =   1200
  44.          Width           =   1215
  45.       End
  46.       Begin VB.CheckBox chkSorted 
  47.          Caption         =   "Sorted"
  48.          Height          =   255
  49.          Left            =   120
  50.          TabIndex        =   2
  51.          Top             =   2400
  52.          Width           =   1215
  53.       End
  54.    End
  55.    Begin VB.Frame fraPreview 
  56.       Caption         =   "Preview"
  57.       Height          =   2775
  58.       Left            =   120
  59.       TabIndex        =   0
  60.       Top             =   120
  61.       Width           =   2415
  62.       Begin VB.ListBox lstPreview 
  63.          Height          =   2400
  64.          ItemData        =   "frmMain.frx":0000
  65.          Left            =   120
  66.          List            =   "frmMain.frx":0002
  67.          TabIndex        =   6
  68.          Top             =   240
  69.          Width           =   2175
  70.       End
  71.    End
  72. End
  73. Attribute VB_Name = "frmMain"
  74. Attribute VB_GlobalNameSpace = False
  75. Attribute VB_Creatable = False
  76. Attribute VB_PredeclaredId = True
  77. Attribute VB_Exposed = False
  78. Option Explicit
  79. Dim objList As New clsList
  80.  
  81. Private Sub RefreshPreview()
  82.     Dim i As Integer
  83.     
  84.     If objList.ListCount = 0 Then Exit Sub
  85.     
  86.     lstPreview.Clear
  87.     For i = 0 To objList.ListCount - 1
  88.         lstPreview.AddItem objList.List(i)
  89.         lstPreview.ItemData(lstPreview.NewIndex) = objList.ItemData(i)
  90.     Next i
  91.     
  92. End Sub
  93.  
  94. Private Sub chkSorted_Click()
  95.     
  96.     objList.Sorted = CBool(chkSorted.Value)
  97.     
  98.     Call RefreshPreview
  99.     
  100. End Sub
  101.  
  102. Private Sub cmdAddItem_Click()
  103.     Dim strUserInput As String
  104.     
  105.     strUserInput = InputBox("Please enter the text for your new list item.", "Enter Text")
  106.     If LenB(strUserInput) = 0 Then Exit Sub
  107.     
  108.     objList.AddItem strUserInput
  109.     
  110.     Call RefreshPreview
  111.     
  112. End Sub
  113.  
  114. Private Sub cmdClear_Click()
  115.     
  116.     objList.Clear
  117.     
  118.     Call RefreshPreview
  119.     
  120. End Sub
  121.  
  122. Private Sub cmdRemoveItem_Click()
  123.     
  124.     If lstPreview.ListIndex < 0 Then Exit Sub
  125.     
  126.     objList.RemoveItem lstPreview.ListIndex
  127.     
  128.     Call RefreshPreview
  129.     
  130. End Sub
  131.  
  132. Private Sub lstPreview_Click()
  133.     
  134.     If lstPreview.ListIndex < 0 Then Exit Sub
  135.     
  136.     lstPreview.ToolTipText = CStr(lstPreview.ItemData(lstPreview.ListIndex))
  137.     
  138. End Sub
  139.